#include "logo_logic_handle.h"
LIGHT_EFFECT_T logo_effect_config= {9,60,12,{0xFF,0X00,0X00, 0X00,0XFF,0X00, 0X00,0X00,0XFF, 0XFF,0XFF,0XFF}};


void logo_display_handle()
{
    u8 buf[BUF_SIZE];
    bzero(buf,BUF_SIZE);
    get_cache_data(buf);
    logic_send_light_msg_ohter(buf,get_color_length());
}


void logo_handle(SYS_OPT_KEY opt)
{
    static int time =0;
    static u16 logo_cont=0; //logo运行时间计数器
    if(app_logic_get_last_ssp() != app_logic_get_ssp())//如果是第一次进入
    {
        LOG_INFO("logo_dazzling\n");
        app_logic_set_last_ssp(app_logic_get_ssp()); //将上次的状态与本次的状态同步
        disp_clear_light();
        disp_clear_cw_light();
        time = arch_os_ms_now();
        set_light_effect_config(logo_effect_config.light_effect_ssp,logo_effect_config.wait,logo_effect_config.len,logo_effect_config.buf);
    }

    if(arch_os_ms_elapsed(time)>=(10)) //10ms轮询一次
    {
        time = arch_os_ms_now();
        logo_display_handle();
        logo_cont++;
    }

    if (logo_cont >= 1000) //10s后进入熄灭状态
    {
        task_wifi_init();
        app_logic_set_ssp(SSP_POWER_OFF); //让设备进入关机模式
        logo_cont=0;
    }
}
